<template>
    <div class="hello">
        <h1>other</h1>
        <h1>{{ count}}</h1>
        <input type="text" v-model="newCount">
        <button @click="resetCount">重置</button>
    </div>
</template>

<script>
    import {mapState} from "vuex"

    export default {
        name: "Other",
        data() {
            return {
                newCount: 0
            }
        },
        mounted() {
            console.log(this);
        },
        methods: {
            resetCount() {
                this.$store.commit("setCount", this.newCount)
            }
        },
        computed: {
            ...mapState(["count"])
        },
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
